#include<cstdio>//uncle-lu
#include<algorithm>
template<class T>void read(T &x)
{
	x=0;int f=0;char ch=getchar();
	while(ch<'0'||ch>'9') { f|=(ch=='-'); ch=getchar(); }
	while(ch<='9'&&ch>='0') { x=(x<<1)+(x<<3)+(ch^48); ch=getchar(); }
	x = f ? -x : x;
	return ;
}

void solution(int);

int n;
long long int X;
char line[70];
char list[70];

void solution(int t)
{
	t = t xor X;
	printf("BV");
	int sit = 1;
	while(t)
	{
		int mod = t % 62;
		list[sit++] = line[mod];
		t/=62;
	}
	for (int i = sit-1; i >= 1; i--) 
		printf("%c",list[i]);
	printf("\n");
	return ;
}

int main()
{
	read(n);read(X);
	for (int i =  0; i < 62; i++) 
		scanf("%c",&line[i]);

	for (int i = 1; i <= n; i++) 
	{
		long long int temp;
		scanf("\nav%lld", &temp);
		solution(temp);
	}

	return 0;
}
